<?xml version="1.0" encoding="UTF-8"?>
<!--
  Created by IntelliJ IDEA.
  User: Nikita.Brazhnikov
  Date: 9/21/12
  Time: 11:16 AM
-->
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsf/core"
      xmlns:f="http://java.sun.com/jsf/facelets">
<c:metadata>
    <c:viewParam name="user" value="#{profile.username}"/>
</c:metadata>
<h:outputStylesheet library="css" name="profile.css"/>
<h:head>
    <title>Profile info view</title>
</h:head>

<h:body>
    <f:decorate template="/templates/master_page_default.xhtml">
        <h:form>
            <div id="profile_view">
                <div class="control_group">
                    <div class="header">Main info</div>
                    <div class="content"><h:inputText value="#{profile.username}" readonly="true"/></div>
                </div>
                <div class="control_group">
                    <div class="header">Notifications</div>
                    <div class="content">
                        <h:selectBooleanCheckbox value="#{profile.recieveNotifications}"
                                                 title="Recieve notifications by email?"/><h:outputText
                            value=" Recieve notifications by email"/><br/>
                        <h:selectManyCheckbox value="#{profile.selectedNotifications}" layout="lineDirection">
                            <c:selectItem itemLabel="New private messages" itemValue="private_msg"/>
                            <c:selectItem itemLabel="New chat invites" itemValue="chat_invite"/>
                            <c:selectItem itemLabel="New tasks opened" itemValue="new_task"/>
                        </h:selectManyCheckbox>
                    </div>
                </div>
                <div class="control_group">
                    <div class="header">Followed projects</div>
                    <h:selectManyCheckbox value="#{profile.selectedProjects}" layout="pageDirection">
                        <c:selectItems value="#{profile.allProjects}" var="p" itemLabel="#{p.name}"
                                       itemValue="#{p.id}"/>
                    </h:selectManyCheckbox>
                </div>
                <div>
                    <div class="horiz_pair_left">
                        <div class="control_group">
                            <div class="header">Notification profile</div>
                            <div class="content">
                                <h:selectOneRadio value="#{profile.selectedNotificationType}" layout="pageDirection">
                                    <c:selectItems value="#{profile.allNotifications}"/>
                                </h:selectOneRadio>
                            </div>
                        </div>
                    </div>
                    <div class="horiz_pair_right">
                        <div class="control_group">
                            <div class="header">Notification frequency</div>
                            <div class="content">
                                <table>
                                    <tr>
                                        <td><h:selectManyListbox value="#{profile.selectedFreqs}"
                                                                 size="6">
                                            <c:selectItems value="#{profile.frequences}"/>
                                        </h:selectManyListbox></td>
                                        <td><h:selectOneMenu value="#{profile.defaultFreq}">
                                            <c:selectItems value="#{profile.frequences}"/>
                                        </h:selectOneMenu></td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                    <!--<div class="clear"></div>-->
                </div>
                <div class="control_group clear">
                    <div class="header">Recent messages</div>
                    <div class="content">
                        <h:panelGrid columns="3" columnClasses="label_col, control_col, msg_col">
                            <span class="label">New messages email</span>
                            <h:inputText id="recent_msg_email"
                                         value="#{profile.appearanceSettings.newMessagesEmail}">
                                <c:validator validatorId="elteam.validator.Email"/>
                            </h:inputText>
                            <h:message for="recent_msg_email"/>
                            <span class="label">Use registration email</span>
                            <h:selectBooleanCheckbox
                                    id="recent_msg_usereg"
                                    value="#{profile.appearanceSettings.useRegistrationEmail}"/>
                            <h:message for="recent_msg_usereg"/>
                            <span class="label">Max recent messages in one email</span>
                            <h:inputText size="3" id="recent_msg_max" value="#{profile.appearanceSettings.maxRecentMessagesConunt}"/>
                            <h:message for="recent_msg_max"/>
                        </h:panelGrid>
                    </div>
                </div>
                <div class="control_group clear">
                    <div class="header">Notifications format</div>
                    <div class="content">
                        <h:panelGrid columns="3" columnClasses="label_col, control_col, msg_col">
                            <span class="label">Format params</span>
                            <h:inputText id="notif_form_string" value="#{profile.appearanceSettings.format}" converter="elteam.convert.MessagesFormat"/>
                            <h:message for="notif_form_string"/>
                        </h:panelGrid>
                    </div>
                </div>
                <div class="control_group clear">
                    <span class="center"><h:commandButton value="Save" action="#{profile.update}"/></span>
                </div>
            </div>
        </h:form>
    </f:decorate>
    <f:debug/>
</h:body>

</html>